<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
<script>
  var num = 10
  let obj = { num: 20 }
  console.log(obj.num)
  obj.fn = (function (num) {
    this.num = num * 3
    num++
    return function (n) {
      this.num += n
      num++
      console.log(num)
    }
  })(obj.num)
  let fn = obj.fn
  fn(5) // 22
  obj.fn(10) // 23
  console.log(num, obj.num) // 65 30
</script>
</body>
</html>